package com.huizu.project.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.huizu.common.annotation.Log;
import com.huizu.common.core.controller.BaseController;
import com.huizu.common.core.domain.AjaxResult;
import com.huizu.common.enums.BusinessType;
import com.huizu.project.domain.ProLd7;
import com.huizu.project.service.IProLd7Service;
import com.huizu.common.utils.poi.ExcelUtil;
import com.huizu.common.core.page.TableDataInfo;

/**
 * 演讲比赛/知识竞赛Controller
 * 
 * @author zhangmx
 * @date 2024-05-10
 */
@RestController
@RequestMapping("/project/prold7")
public class ProLd7Controller extends BaseController
{
    @Autowired
    private IProLd7Service proLd7Service;

    /**
     * 查询演讲比赛/知识竞赛列表
     */
    @PreAuthorize("@ss.hasPermi('project:prold7:list')")
    @GetMapping("/list")
    public TableDataInfo list(ProLd7 proLd7)
    {
        startPage();
        List<ProLd7> list = proLd7Service.selectProLd7List(proLd7);
        return getDataTable(list);
    }

    /**
     * 导出演讲比赛/知识竞赛列表
     */
    @PreAuthorize("@ss.hasPermi('project:prold7:export')")
    @Log(title = "演讲比赛/知识竞赛", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, ProLd7 proLd7)
    {
        List<ProLd7> list = proLd7Service.selectProLd7List(proLd7);
        ExcelUtil<ProLd7> util = new ExcelUtil<ProLd7>(ProLd7.class);
        util.exportExcel(response, list, "演讲比赛/知识竞赛数据");
    }

    /**
     * 获取演讲比赛/知识竞赛详细信息
     */
    @PreAuthorize("@ss.hasPermi('project:prold7:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") String id)
    {
        return success(proLd7Service.selectProLd7ById(id));
    }

    /**
     * 新增演讲比赛/知识竞赛
     */
    @PreAuthorize("@ss.hasPermi('project:prold7:add')")
    @Log(title = "演讲比赛/知识竞赛", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody ProLd7 proLd7)
    {
        return toAjax(proLd7Service.insertProLd7(proLd7));
    }

    /**
     * 修改演讲比赛/知识竞赛
     */
    @PreAuthorize("@ss.hasPermi('project:prold7:edit')")
    @Log(title = "演讲比赛/知识竞赛", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody ProLd7 proLd7)
    {
        return toAjax(proLd7Service.updateProLd7(proLd7));
    }

    /**
     * 删除演讲比赛/知识竞赛
     */
    @PreAuthorize("@ss.hasPermi('project:prold7:remove')")
    @Log(title = "演讲比赛/知识竞赛", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable String[] ids)
    {
        return toAjax(proLd7Service.deleteProLd7ByIds(ids));
    }
}
